(function(angular) {
	'use strict';
	angular.module('fs.waf').controller('cda.popup.acctCcyViewController', accountCcyViewController);
	accountCcyViewController.$inject = [ '$scope', '$uibModalInstance', 'Constants', 'dialogsModule', 'gridService', 'layoutConfig', 'validatorConfig', 'authService', 'accountService'];
	function accountCcyViewController($scope, $uibModalInstance, Constants, dialogsModule, gridService, layoutConfig, validatorConfig, authService, accountService) {
		var ctrl = this, log = $scope.loggerFactory.getLogger("accountCcyViewPopup");
		ctrl.dialogsModule = dialogsModule;
		ctrl.layoutConfig = layoutConfig;
		ctrl.validatorConfig = validatorConfig;
		
		ctrl.close = function() {
			if (!dialogsModule.btnCallback || !dialogsModule.btnCallback['close'] || dialogsModule.btnCallback['close']() !== false) {
				$uibModalInstance.dismiss();
			}
		};
		
		ctrl.init = function() {
			accountService.initOptions().then(function(result){
				//Initialization data
				ctrl.custAcctFlagOptions = result.custAcctFlagOptions;
				ctrl.acctPatternFlagOptions = result.acctPatternFlagOptions;
				ctrl.splitFlagOptions = result.splitFlagOptions;
				ctrl.summaryFlag1Options = result.summaryFlag1Options;
				ctrl.summaryFlag2Options = result.summaryFlag2Options;
				ctrl.acctTypeOptions = result.acctTypeOptions;
				ctrl.partyTypeOptions = result.partyTypeOptions;
				ctrl.acctCcyOptions = result.acctCcyOptions;
				ctrl.acctNoOptions = result.acctNoOptions;
				ctrl.accountPatterns = result.accountPatterns;
				ctrl.accountPatternsTwo = result.accountPatternsTwo;
				
				if (ctrl.dialogsModule.params.acctCcy) {
					ctrl.acctCcy = ctrl.dialogsModule.params.acctCcy;
				} else {
					ctrl.acctCcy = {};
				}
				if (ctrl.dialogsModule.params.acctCcyOld) {
					ctrl.acctCcyOld = ctrl.dialogsModule.params.acctCcyOld;
				} else {
					ctrl.acctCcyOld = {};
				}
			});
		};
		
	}
})(angular);